﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Web.Core;
using System.Collections;

namespace Yuanlin.Business
{
    public class CompanyProduct : AttachmentEntity
    {
        private Property<string> title = new Property<string>();//常用名
        private Property<string> pinNameTitle = new Property<string>();//品名
        private Property<string> tradeType = new Property<string>();//交易类别:0--出售花木，1--精品花木，2--求购花木，3--急售花木
        private Property<int> categoryId = new Property<int>();//植物方面分类
        private Property<int> number = new Property<int>();//数量
        private Property<int> productPriceFromFace = new Property<int>();//是否面议
        private Property<double> price = new Property<double>();//价格
        private Property<double> avgPrice = new Property<double>();//平均价格
        private Property<double> miJing = new Property<double>();//米经
        private Property<double> diJing = new Property<double>();//地径
        private Property<string> zhongzhiMethod = new Property<string>();//种植方式
        private Property<string> shangBiao = new Property<string>();//苗木属性
        private Property<string> guiGeNames = new Property<string>();//植物方面分类下的规格
        private Property<string> guiGeValues = new Property<string>();
        private Property<string> guiGeUnits = new Property<string>();
        private Property<string> guiAppGeNames = new Property<string>();//应用方面分类下的规格
        private Property<string> guiAppGeValues = new Property<string>();
        private Property<string> guiAppGeUnits = new Property<string>();
        private Property<string> companyName = new Property<string>();
        private Property<string> greenNum = new Property<string>();
        private Property<string> registerTrademark = new Property<string>();//注册商标
        private Property<int> province = new Property<int>();
        private Property<int> city = new Property<int>();
        private Property<int> town = new Property<int>();
        private Property<int> smallTown = new Property<int>();
        private Property<int> expiredInfo = new Property<int>();//信息有效期
        private Property<int> productId = new Property<int>();
        private Property<string> body = new Property<string>();
        private Property<DateTime> createDate = new Property<DateTime>();
        private Property<DateTime> updateDate = new Property<DateTime>();
        private Property<int> userId = new Property<int>();
        private Property<int> verify = new Property<int>();

        public Property<int> CategoryId
        {
            get { return categoryId; }
            set { categoryId = value; }
        }
        public Property<int> Number
        {
            get { return number; }
            set { number = value; }
        }
        public Property<int> ProductPriceFromFace
        {
            get { return productPriceFromFace; }
            set { productPriceFromFace = value; }
        }
        public Property<int> Province
        {
            get
            {
                return province;
            }
            set
            {
                province = value;
            }
        }
        public Property<int> City
        {
            get
            {
                return city;
            }
            set
            {
                city = value;
            }
        }
        public Property<int> Town
        {
            get
            {
                return town;
            }
            set
            {
                town = value;
            }
        }
        public Property<int> SmallTown
        {
            get
            {
                return smallTown;
            }
            set
            {
                smallTown = value;
            }
        }
        public Property<int> ExpiredInfo
        {
            get
            {
                return expiredInfo;
            }
            set
            {
                expiredInfo = value;
            }
        }
        public Property<int> ProductId
        {
            get
            {
                return productId;
            }
            set
            {
                productId = value;
            }
        }
        public Property<int> UserId
        {
            get { return userId; }
            set { userId = value; }
        }
        public Property<string> Title
        {
            get { return title; }
            set { title = value; }
        }
        public Property<string> PinNameTitle
        {
            get { return pinNameTitle; }
            set { pinNameTitle = value; }
        }
        public Property<string> TradeType
        {
            get { return tradeType; }
            set { tradeType = value; }
        }
        public Property<string> ZhongzhiMethod
        {
            get { return zhongzhiMethod; }
            set { zhongzhiMethod = value; }
        }
        public Property<string> SeedlingAttribute
        {
            get { return shangBiao; }
            set { shangBiao = value; }
        }
        public Property<string> GuiGeNames
        {
            get { return guiGeNames; }
            set { guiGeNames = value; }
        }
        public Property<string> GuiGeValues
        {
            get { return guiGeValues; }
            set { guiGeValues = value; }
        }
        public Property<string> GuiGeUnits
        {
            get { return guiGeUnits; }
            set { guiGeUnits = value; }
        }
        public Property<string> CompanyName
        {
            get
            {
                return companyName;
            }
            set
            {
                companyName = value;
            }
        }
        public Property<string> GuiAppGeNames
        {
            get { return guiAppGeNames; }
            set { guiAppGeNames = value; }
        }
        public Property<string> GuiAppGeValues
        {
            get { return guiAppGeValues; }
            set { guiAppGeValues = value; }
        }
        public Property<string> GuiAppGeUnits
        {
            get { return guiAppGeUnits; }
            set { guiAppGeUnits = value; }
        }
        public Property<string> RegisterTrademark
        {
            get { return registerTrademark; }
            set { registerTrademark = value; }
        }
        public Property<string> GreenNum
        {
            get { return greenNum; }
            set { greenNum = value; }
        }
        public Property<double> Price
        {
            get { return price; }
            set { price = value; }
        }
        public Property<double> MiJing
        {
            get { return miJing; }
            set { miJing = value; }
        }
        public Property<double> DiJing
        {
            get { return diJing; }
            set { diJing = value; }
        }
        public Property<double> AvgPrice
        {
            get { return avgPrice; }
            set { avgPrice = value; }
        }
        public Property<string> Body
        {
            get { return body; }
            set { body = value; }
        }
        public Property<DateTime> CreateDate
        {
            get
            {
                return createDate;
            }
            set
            {
                createDate = value;
            }
        }
        public Property<DateTime> UpdateDate
        {
            get
            {
                return updateDate;
            }
            set
            {
                updateDate = value;
            }
        }
        public Property<int> Verify
        {
            get { return verify; }
            set { verify = value; }
        }

        public string GetGuiGeValue(string name)
        {
            if (!string.IsNullOrEmpty(GuiGeNames.Value) && !string.IsNullOrEmpty(GuiGeValues.Value) && !string.IsNullOrEmpty(GuiGeUnits.Value))
            {
                string[] names = GuiGeNames.Value.Split(new string[] { "|" }, StringSplitOptions.None);
                string[] values = GuiGeValues.Value.Split(new string[] { "|" }, StringSplitOptions.None);
                string[] units = GuiGeUnits.Value.Split(new string[] { "|" }, StringSplitOptions.None);

                if (names != null && values != null && units != null && names.Length == values.Length && names.Length == units.Length)
                {
                    string format = "{0}{1}";
                    for (int i = 0; i < names.Length; i++)
                    {
                        if (names[i].IndexOf(name) >= 0)
                        {
                            return string.Format(format, values[i], "&nbsp;");
                        }
                    }
                }
            }
            return "&nbsp;";
        }

        public string GetGuiGeNameValues()
        {
            if (!string.IsNullOrEmpty(GuiGeNames.Value) && !string.IsNullOrEmpty(GuiGeValues.Value) && !string.IsNullOrEmpty(GuiGeUnits.Value))
            {
                string[] names = GuiGeNames.Value.Split(new string[] { "|" }, StringSplitOptions.None);
                string[] values = GuiGeValues.Value.Split(new string[] { "|" }, StringSplitOptions.None);
                string[] units = GuiGeUnits.Value.Split(new string[] { "|" }, StringSplitOptions.None);

                if (names != null && values != null && units != null && names.Length == values.Length && names.Length == units.Length)
                {
                    List<string> items = new List<string>();
                    string format = "{0}：{1}{2}<br/>";
                    for (int i = 0; i < names.Length; i++)
                    {
                        items.Add(string.Format(format, names[i], values[i], string.Empty));
                    }
                    return string.Join("", items.ToArray());
                }
            }
            return string.Empty;
        }
        public string GetTradeType(string tradeType)
        {
            string tmpTradeType = string.Empty;
            switch (tradeType)
            {
                case "0":
                    tmpTradeType = ResourceManager.GetString("Huamu");
                    break;
                case "1":
                    tmpTradeType = ResourceManager.GetString("Huamujingpin");
                    break;
                case "2":
                    tmpTradeType = ResourceManager.GetString("Huamuqiugou");
                    break;
                case "3":
                    tmpTradeType = ResourceManager.GetString("Huamujishou");
                    break;
            }
            return tmpTradeType;
        }

       
    }
}